entry: Use gtk_render_layout()
authorBenjamin Otte <otte@redhat.com>
Sun, 24 Jan 2016 23:07:23 +0000 (00:07 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 25 Jan 2016 14:49:17 +0000 (15:49 +0100)
It's funny that nobody has yet noticed that we don't draw the text using
the theme.

We had no text-shadow in entries!!!!!

gtk/gtkentry.c

index 67b14c548249c47f9cf4873ada8b3c0418ed011c..031e88bdb8965cfa6aa7993d989e51e4909a283c 100644 (file)
@@ -6467,7 +6467,6 @@ gtk_entry_draw_text (GtkEntry *entry,
 {
   GtkEntryPrivate *priv = entry->priv;
   GtkWidget *widget = GTK_WIDGET (entry);
-  GdkRGBA text_color;
   GtkStyleContext *context;
   PangoLayout *layout;
   gint x, y;
@@ -6482,10 +6481,6 @@ gtk_entry_draw_text (GtkEntry *entry,
   gtk_widget_get_allocation (GTK_WIDGET (entry), &allocation);
   layout = gtk_entry_ensure_layout (entry, TRUE);
 
-  gtk_style_context_get_color (context,
-                               gtk_style_context_get_state (context),
-                               &text_color);
-
   cairo_save (cr);
 
   cairo_rectangle (cr,
@@ -6499,9 +6494,7 @@ gtk_entry_draw_text (GtkEntry *entry,
   if (show_placeholder_text (entry))
     pango_layout_set_width (layout, PANGO_SCALE * gdk_window_get_width (entry->priv->text_area));
 
-  cairo_move_to (cr, x, y);
-  gdk_cairo_set_source_rgba (cr, &text_color);
-  pango_cairo_show_layout (cr, layout);
+  gtk_render_layout (context, cr, x, y, layout);
 
   if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos))
     {
@@ -6522,10 +6515,7 @@ gtk_entry_draw_text (GtkEntry *entry,
                              0, 0,
                              allocation.width, allocation.height);
 
-      cairo_move_to (cr, x, y);
-      gtk_style_context_get_color (context, gtk_style_context_get_state (context), &text_color);
-      gdk_cairo_set_source_rgba (cr, &text_color);
-      pango_cairo_show_layout (cr, layout);
+      gtk_render_layout (context, cr, x, y, layout);
 
       gtk_style_context_restore (context);
     }